package com.yzh.homework;

/**
 * @author 于振晗
 * @title: HomeWork01
 * @description: TODO 定义一个英雄类（Hero），属性有：姓名name、生命值hp、移动速度moveSpeed、
 *                  攻击速度attackSpeed，方法有：自报家门introduce()、移动move()和
 *                  攻击attack(String direction)。并编写测试类，创建具体的英雄，运行效果如下
 * @date 2020年08月24日
 * @path com.yzh.homework
 */
public class HomeWork01 {
    String name;
    int hp;
    int moveSpeed;
    int attackSpeed;

    public HomeWork01(String name, int hp, int moveSpeed, int attackSpeed) {
        this.name = name;
        this.hp = hp;
        this.moveSpeed = moveSpeed;
        this.attackSpeed = attackSpeed;
    }

    public void introduce(){
        System.out.println("在下"+name+",声明值是"+hp);
    }
    //move
    public void move(){
        System.out.println("关于开始移动，移动速度是"+moveSpeed);
    }
    //attack
    public void attack(String direction){
        System.out.println(name+"进行攻击，攻击方向是"+direction+"，攻击速度是"+attackSpeed);
    }
    public static void main(String[] args) {
        HomeWork01 work01 = new HomeWork01("关羽", 100, 30, 30);
        HomeWork01 work02 = new HomeWork01("秦琼", 100, 20, 35);
        work01.introduce();
        work02.introduce();
        work01.move();
        work02.move();
        work01.attack("西北");
        work02.attack("东南");
    }
}
